package com.shopping.dev.controller;

import com.shopping.dev.bo.AddressBO;
import com.shopping.dev.bo.CommonResultBO;
import com.shopping.dev.bo.SubmitOrderBO;
import com.shopping.dev.bo.UserBO;
import com.shopping.dev.common.util.CookieUtil;
import com.shopping.dev.pojo.UserAddress;
import com.shopping.dev.service.AddressService;
import com.shopping.dev.service.OrderService;
import com.shopping.dev.vo.OrderVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import tk.mybatis.mapper.util.StringUtil;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Base64;
import java.util.List;

@Api(value = "订单", tags = { "订单相关api接口" })
@RestController
@RequestMapping("orders")
public class OrdersController extends BaseController {
    @Autowired
    private OrderService orderService;
    public CommonResultBO create(@RequestBody SubmitOrderBO submitOrderBO, HttpServletRequest req, HttpServletResponse resp){
        OrderVO order = orderService.createOrder(submitOrderBO);
        //TODO
        CookieUtil.setCookie(req,resp,SHOPCART,"",0,true);
        return CommonResultBO.ok(order);
    }
}
